﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows.Controls;
using GalaSoft.MvvmLight.Messaging;

namespace Songhay.Silverlight.BiggestBox.AdditionalSamplesPart
{
    using Songhay.Composition;
    using Songhay.Models;
    using Songhay.Mvvm.Models;
    using Songhay.Silverlight.BiggestBox.AdditionalSamplesPart.Views;

    [Export(typeof(ICompositionMessaging))]
    public class CompositionMessaging : ICompositionMessaging
    {

        #region ICompositionMessaging Members

        public void RegisterMessageReceivers()
        {
        }

        public void SendCompositionMessages()
        {
            var data = new List<LazyDisplayItem<UserControl>>();

            #region data:

            var item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new AnalogDigitControlSample()),
                "AnalogDigitControlSample",
                "Custom Control: Analog Rolling Digit sample.");
            data.Add(item);

            item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new DVBarChartSample()),
                "DVBarChartSample",
                "Data Visualization: Bar Chart sample.");
            data.Add(item);

            item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new DVColumnChartSample()),
                "DVColumnChartSample",
                "Data Visualization: Column Chart sample.");
            data.Add(item);

            item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new SlideshowSample()),
                "SlideshowSample",
                "Slideshow with TransitioningContentControl sample.");
            data.Add(item);

            item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new TelerikRadialGaugeSample()),
                "TelerikRadialGaugeSample",
                "Telerik Radial Gauge sample (2011 Telerik Release).");
            data.Add(item);

            item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new TelerikRadialGaugeCustomizedSample()),
                "TelerikRadialGaugeCustomizedSample",
                "Telerik Radial Gauge Customized sample (2011 Telerik Release).");
            data.Add(item);

            item = UserControlUtiltity.GetLazyDisplayItem(
                new Func<UserControl>(() => new TransitioningContentControlSample()),
                "TransitioningContentControlSample",
                "TransitioningContentControl with UserControl collection sample.");
            data.Add(item);

            #endregion

            var message = new LightMessage<IEnumerable<LazyDisplayItem<UserControl>>>(data)
            {
                Source = LightMessageSource.CompositionMessagingCore,
                UniqueId = "UserControlsPage"
            };

            Messenger.Default.Send(message);
        }

        #endregion
    }
}
